load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("//build:STRINGER.bzl", "stringer")

go_library(
    name = "schemafeed",
    srcs = [
        "gen-tableEventType-stringer",  # keep
        "metrics.go",
        "schema_feed.go",
        "table_event_filter.go",
        "timestamp_barrier.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/ccl/changefeedccl/schemafeed",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/ccl/changefeedccl/changefeedbase",
        "//pkg/ccl/changefeedccl/changefeedvalidators",
        "//pkg/keys",
        "//pkg/kv",
        "//pkg/kv/kvpb",
        "//pkg/roachpb",
        "//pkg/settings",
        "//pkg/settings/cluster",
        "//pkg/sql/catalog",
        "//pkg/sql/catalog/descbuilder",
        "//pkg/sql/catalog/descpb",
        "//pkg/sql/catalog/descs",
        "//pkg/sql/catalog/lease",
        "//pkg/sql/catalog/typedesc",
        "//pkg/sql/execinfra",
        "//pkg/sql/schemachanger/scpb",
        "//pkg/storage",
        "//pkg/util/encoding",
        "//pkg/util/hlc",
        "//pkg/util/intsets",
        "//pkg/util/log",
        "//pkg/util/metric",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",
        "@com_github_cockroachdb_errors//:errors",
    ],
)

go_test(
    name = "schemafeed_test",
    size = "large",
    srcs = [
        "helpers_test.go",
        "main_test.go",
        "schema_feed_test.go",
        "table_event_filter_datadriven_test.go",
        "table_event_filter_test.go",
        "timestamp_barrier_test.go",
    ],
    data = glob(["testdata/**"]),
    embed = [":schemafeed"],
    deps = [
        "//pkg/base",
        "//pkg/ccl",
        "//pkg/ccl/changefeedccl/changefeedbase",
        "//pkg/ccl/changefeedccl/schemafeed/schematestutils",
        "//pkg/jobs/jobspb",
        "//pkg/keys",
        "//pkg/kv/kvpb",
        "//pkg/kv/kvserver",
        "//pkg/roachpb",
        "//pkg/security/securityassets",
        "//pkg/security/securitytest",
        "//pkg/server",
        "//pkg/sql",
        "//pkg/sql/catalog",
        "//pkg/sql/catalog/descpb",
        "//pkg/sql/catalog/lease",
        "//pkg/sql/catalog/tabledesc",
        "//pkg/testutils",
        "//pkg/testutils/datapathutils",
        "//pkg/testutils/serverutils",
        "//pkg/testutils/sqlutils",
        "//pkg/testutils/testcluster",
        "//pkg/util/admission",
        "//pkg/util/hlc",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "//pkg/util/randutil",
        "//pkg/util/timeutil",
        "@com_github_cockroachdb_datadriven//:datadriven",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_gogo_protobuf//proto",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
    ],
)

stringer(
    name = "gen-tableEventType-stringer",
    src = "table_event_filter.go",
    additional_args = ["--trimprefix=tableEvent"],
    typ = "tableEventType",
)
